from django.db import models


# Create your models here.

class Category(models.Model):
	title = models.CharField(verbose_name="分类名", max_length=30)

	def __str__(self):
		return self.title


class Book(models.Model):
	title = models.CharField(verbose_name="书名", max_length=30)
	category = models.ForeignKey(verbose_name="所属类名", to=Category, on_delete=models.CASCADE)

	def __str__(self):
		return self.title
